package com.kefu.chat.vo;

import cn.hutool.core.bean.BeanUtil;
import com.kefu.chat.model.ChatMenuConfigPlan;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class ChatMenuConfigPlanInsertVo extends AbstractInsertVo<ChatMenuConfigPlan> {
    @ApiModelProperty(value = "方案名称")
    private String planName;

    @ApiModelProperty(value = "方案备注")
    private String planRemark;

    @ApiModelProperty(name = "sortNo", value = "排序")
    private Integer sortNo;

    @ApiModelProperty(name = "menus", value = "快捷菜单列表")
    private String menus;

    @ApiModelProperty(name = "enableStatus", value = "是否启用 0=未启用，1=启用")
    private Integer enableStatus;

    @ApiModelProperty(value = "渠道id")
    private String channelId;

    @ApiModelProperty(value = "触发器id， 暂时保留")
    private String triggerId;

    @ApiModelProperty(value = "进入标志 0=建立会话，1=进入机器人会话，2=进入人工会话")
    private Integer postCondition;

    @Override
    public ChatMenuConfigPlan convert() {
        KefuContext context = KefuContext.getKefuContext();
        ChatMenuConfigPlan info = BeanUtil.toBean(this, ChatMenuConfigPlan.class);
        info.setUpdateTime(context.getNow());
        info.setCreateTime(context.getNow());
        info.setCreateUser(context.getUserId());
        info.setUpdateUser(context.getUserId());
        info.setCreateName(context.getUserName());
        info.setUpdateName(context.getUserName());
        info.setTenantId(context.getTenantId());
        return info;
    }
}
